\ SED.TXT The sequential editors documentation by Tom Zimmer SED and Overview SED is a text editor implemented in Forth, with cursor movement key sequences similar to WordStar. Sed provides pull-down menus for ease of operation, with on-line help for most functions. Press ESC to pop up the menubar, then type the first letter of the menu name to see the menu. Press the FIRST CAPITALIZED letter of a menu item to pick that item, or use the arrow keys to step down to it and press . Press ESC again to clear the menubar. The on-line help is brought on screen by pressing F1, after which you can press any of the NUMBER keys to see the additional help screen on various topics as described in the F1 screen. Press ESC to return to the editor. Glossary of Editor Operations Column Move Right Alt-L All of the lines of a column of data can be moved to the right by a number of characters from 1 to 9. the specified number of spaces are inserted at the column of all lines from the current line until a blank line is encountered. Copying Lines F3 & F5 Lines can be copied from one place in a file to another, with the Mark-F3, and Copy Line-F5 commands. Move to the first line of the block of text you wish to copy, and Mark the start of the copy with Mark-F3, now move to the place where you want to copy the text to, and press Copy-F5 once for each line you want to copy. Copying text to a File Alt-C and Shift Alt-C SED can copy lines of text to another file. With Alt-C, first go to the first line of text you want to copy, and press F3 mark to mark the start of the block copy. Then move to the last line of text you want to cut, and press Alt-C. This will cause all of the lines between and including the start and end line to be written out to the file TEMP.SEQ. To specify a different filename to copy to, press Shift-Alt-C, instead of Alt-C and you will be prompted for a name to write to. See also "Cutting text to a File", and "Copying from a File". Cutting text to a File Alt-X and Shift Alt-X SED can cut lines of text to another file. With Alt-X, first go to the first line of text you want to cut, and press F3 mark to mark the start of the block cut. Then move to the last line of text you want to cut, and press Alt-X. This will cause all of the lines between and including the start and end line to be written out to the file TEMP.SEQ. The lines will also be deleted from the current file. To specify a different filename to cut to, press Shift-Alt-X, instead of Alt-X, and you will be prompted for a name to write to. See also "Pasting from a File", and "Copying from a File". Delete and Un-Delete lines Control-Y & Alt-Y Lines can be deleted with Ctrl-Y, and un-deleted with Alt-Y. Any lines which are deleted are saved in a line delete buffer which currently has room for 50 lines. This is also the number of line deletes which can be un-deleted. Delete Leading Blanks from a Column Shift-Alt-L All of the spaces in the current line at the cursor column to the right are removed. This is done to each following line until a blank line is encountered. DRAWING with the line character set F9 Pressing F9 will enter a character line drawing mode. You can press the arrow keys to move around on the screen and draw lines. This is most useful for prettying up your documentation. Pressing F9 or ESC will take you back to normal edit mode. Expanding TABS in a file Alt-O X To expand TABS which appear in a file as small diamonds, press Alt-O (option), followed by X expand tabs. All TABS in the current file starting at the cursor will be expanded to eight (8) character columns. Exporting to another file Alt-W The current edit file can be written out to another file. By pressing Alt-W, you will be asked for the name of the file to write out to. The entire file contents in memory will be written out to the new filename. If you want to export a small amount of text to another file, you can use the Alt-X Export function. HELP, on line F1 Press F1 for on-line help on the various commands available. Inserting Special characters in SED The F10 function allows any single character which can be generated by the keyboard to be inserted into SED. Simply press F10 followed by the key you want to insert. Function keys are mapped to characters above 127, so they will show up as graphics characters. Left Margin Ctrl-L The left margin on the screen defaults to column zero, but when printed, defaults to 2 spaces, so it is not normally necessary to insert a left margin. However, when TAB is pressed, the left margin on screen is expanded by 8 characters. Any subsequent lines typed in will maintain this margin. The left margin can be set at any column position. Move the cursor to the column where you want the left margin set and press Ctrl-L. LOWER CASE conversion Alt-O L To convert the current line to lower case, press Alt-O (option), followed by L. All upper case characters in the current line will be converted to lower case. See also UPPER CASE conversion. MACROS and F-PC Alt-M, Alt-1..5 SED does not have macros built into it, but a file is provided called MACROS.SEQ, which implements macros in Forth that can be used in SED. These macros work exactly the same as they work in ZED. That is, you use Alt-M to start defining a macro, followed by one of the Alt-1 to Alt-5 keys for the macro you are defining. Next you enter any keys you want included in the macro, and finally press Alt-M again to complete the macro definition. To perform a macro, simply press one of the Alt-1 through Alt-5 keys by it self, and the keys saved will be performed. Marker, Page Break (a down pointing arrow head) The down pointing arrow head symbol is used by SED to mark the first line of a NEW page, so you will notice this symbol appears at the left edge of the screen at the top of the document. Marker, End of File (an up pointing arrow head) The up pointing arrow head symbol is used by SED to mark the last line of text in the file. MENUS, Displaying and using ESC Pressing the ESC key while editing, changes the first edit line to display the MENUBAR. The most recently used menu item will be in reverse video. If you press DOWN ARROW, the menu contests for the highlighted menu will be pulled down, you can then press LEFT and RIGHT ARROW to step across the menus. Press when the menu item you want is selected. you can also select menu items by pressing the first UPPERCASE LETTER in a menubar or menu item. The final way you can select a menu item, is to note the Alt or Control key to use for the desired item, and then press that key AFTER pressing ESC again to make the menubar disappear. Pasting the DATE & TIME Alt-O P You can paste the date and time into a document at any time, with Alt-O P. Pasting from a File Alt-V Text which has been cut with the Alt-X (cut) command to the TEMP.SEQ file can be pasted back with Alt-V, the paste command. If you want to paste a file other than TEMP.SEQ, you can press Shift-Alt-V, and a window will pop-up for you to select a file from. If you press Esc during the paste, or while in the file selection window, the import operation will be aborted. See also "Cutting text to a File". Printing Documents Alt-P Printing can be initiated Alt-P. It will take you to a screen where you can set the printing parameters, like first and last page to print, copies to print, etc. These values default to the most common situation, which is to print all of a document once. To start printing, press "P", or press ESC to abort. Reading Foreign documents Alt-K Tab expansion If you want to read a text file from an editor which imbeds Tabs, you will see this character " " in many places in the file when you first start editing it. If you do see these Tab characters, press Alt-K, and these characters will be expanded to spaces properly. This process will increase the size of the file somewhat, so if you are doing this to a very large file, you may run out of the 64000 character memory space available. WordStar document files will need to passed through a conversion utility before being edited by SED. Replacing Text F8-Replace & Alt-F8 After a Search has been done, you can replace the text found. Press F8. You will be asked for a replacement string, which will be used to replace the found text, when return is pressed. To search for the next occurrence of the same text, press Alt-F6, and to replace the next found occurrence with the same replacement text, press Alt-F8. Replacing All Occurrences of Text Shift-F8 Having already performed a Search (F6) and Replace (F8) once, you can replace all occurrences of search text with replacement text by pressing Shift-F8. Searching for Text F6-Search & Alt-F6 You can look for any sequence of characters in SED with the Search-F6 key. When F6 is pressed, you are asked to enter a text string to look for. SED will look for that string of characters when you press . When SED searches for text, it ignores the case of the letters. If you want SED to look at the CaSe of the text it searches, hold down SHIFT while pressing . This search is much faster. To search for another occurrence of the same text string, press Alt-F6 (or SHIFT Alt-F6 if you want only an exact match). See also the earlier section on Replacing Text. Searching for Text Backwards Shift-F6 Having already done a search using F6 above, you can also search backwards with Shift-F6, which searches backwards from the cursor with a CaSe sensitive search. Selecting a File to Edit A new file selection mechanism has been added. When you are being asked to enter a new filename, if you press ENTER without entering a filename, a window will pop up allowing you to select a file from the directory. If you are in a sub-directory when the window appears, then a file named "." and a file named ".." will appear at the top of the file list. These files, along with any directories below the current directory, will display a graphic "infinity" symbol "ì" to the right of the filename. If you press while positioned on the "." name you will select the ROOT directory. The ".." name will pop up one level of directory, and any other name with the "infinity" symbol next to it will step you down one level to that directory. You can move between files in the list, with the keypad arrow keys, and select a file by pressing ENTER. Escape can be used to abort file selection. While in the pop up file selection mode, you can also set the current drive by pressing a letter key between A and G. This drive must exist and have a disk in it, or a system error will result. The path and the current drive is displayed in the lower right. The path can be changed by pressing the "\" key, then typing the new path followed by the return key. A filename can be specified on the command line when starting SED, and may include a directory specification. Sorting the lines of a paragraph F7 An interesting although relatively slow function in SED is the F7 key that will sort the lines of the current paragraph starting on the cursor line and continuing until a blank line is encountered. The sort starts at the current column, and tests the next 10 characters to perform the sort. It is possible to create simple databases or phone lists, by placing different peices if information at specific columns, and using F7 to sort according to these columns as needed. For example I have a phone list that I can sort according to firstname, lastname, areacode, state, or zip as needed. Status Line The top line of the display shows the current edit status, starting with INSERT/OVERWRITE status, which is also shown by a thicker cursor for insert mode. The current Column and Line number are then displayed, followed by the page number, total lines in file and total characters in file. Tab setting Alt-T Set the TAB key to tab to the current column, if you are on column 4, TABS will occur at column 4, 8, 12, 16, etc. UPPER CASE conversion Alt-O U To convert the current line to UPPER CASE, press Alt-O (option), followed by U. All upper case characters in the current line will be converted to UPPER CASE. See also LOWER CASE conversion. Wordstar key functions SED tries somewhat half heartedly to be WordStar compatible. The cursor movement keys, Control A,S,D,F,E,X,C,R,W and Z have been maintained, as have the delete keys Control G,T,Y, and Del. Key Definition Index Control keys A Previous word. B Paragraph reformat C Next page, Page Down. D Right one character. E Previous line, Up Line. F Forward, Next word. G Delete the character UNDER the cursor. H Move left one character non-destructively. I Same as TAB. J .. K .. L Set left margin to current column. M Like the key. N Split line at cursor. See also Alt-N (join line). O .. P .. Q .. R Previous page, Page Up. S Left one character. T Delete the word to the right. U Update, save changes up to this moment. V Insert/ Overwrite mode toggle. W Scroll screen down. X Next line, Down Line. Y Cut/Delete the current Line. Z Scroll the screen up. Keypad Functions ESC POP-UP the MENUBAR. Home Goto beginning of line. End Goto end of line. PgUp Go back towards beginning of document 12 lines. PgDn Go towards end of document 12 lines. Ctrl-Home Go to First line of document. Ctrl-End Goto last line of document. Ins Toggle between Insert and Overwrite mode. Del Delete the character under the cursor. Alternate Keys A APPEND marked text to TEMP.SEQ. B .. C Copy Text from Mark to TEMP.SEQ. D .. E .. F .. G Prompt for PAGE to GOTO. H .. I .. J .. K .. L Set left margin to current column. M DEFINE a MACRO. N Join Lines, the inverse of Control N. O U-uppercase Line, L-lowercase line, P-Paste date/time, X-eXpand TABS to spaces P Enter the PRINT menu. Q Goto beginning of the file. R REPEAT a macro. S SETUP Right Margin, and WINDOW size. T Set the TAB key to expand to the current column. U Word Undelete, undeletes the last 10 words or so. V Import a file, pops up a selection window. W SAVEAS, Write entire file to a new file. X CUT lines from mark through cursor to TEMP.SEQ Y Un-delete lines. Z Goto the end of the file. Function Keys F1 Online HELP F2 Go to TOP of screen F3 Mark line, for copy lines, and export lines. F4 Go to BOTTOM of screen F5 Get a line from the mark. F6 Search, prompts for search text. F7 SORT the line of the current paragraph. F8 Replace, prompts for replace text, must do F6 first. F9 Enter LINE DRAWING mode. F10 SAVE and EXIT the editor. Alt-F1 .. Alt-F2 .. Alt-F3 .. Alt-F4 .. Alt-F5 .. Alt-F6 Search for same text again, no prompt. Alt-F7 .. Alt-F8 Replace with same text again, no prompt and do Alt-F6. Alt-F9 .. Alt-F10 DISCARD CHANGES and leave the editor. Shift-F6 Search for text backwards, CaSe sensitive. Shift-F8 Replace all occurrences, use after F6 and F8. Shift-Alt-F6 Search for same text again, no prompt Case Sensitive. Shift-Alt-F8 Replace with same text again, no prompt Case Sensitive. NOTES on F6 and F8 The straight key, F6 or F8 will perform the specified operation, with a prompt for a text string parameter. The operation is performed with a case insensitive search. That is, "CaSe" is the same as "case". The Alt-F6 or Alt-F8 performs the same function, but with the same text string as was entered with the non-Alt key. Again, the search is case insensitive. Holding down Shift while pressing return on F6, Alt-F6 or Alt-F8 will cause the search to be done CASE SENSITIVE. That is, "CaSe" is NOT the same as "case". And finally, pressing Shift-F8, WITHOUT ALT, causes a global replace all occurrences to be performed. While the above may seem confusing at first, it provides a lot of flexibility and power for search and replace operations. Try these commands on a junk file until you become familiar with their operation.